Skip to content

feat: add Sandbox support to NetworkPolicy controller - #345

Merged
cwiklik merged 1 commit into
mainfrom
feat/sandbox-networkpolicy
May 8, 2026
Merged

feat: add Sandbox support to NetworkPolicy controller#345
cwiklik merged 1 commit into
mainfrom
feat/sandbox-networkpolicy

Conversation

@cwiklik

@cwiklik cwiklik commented May 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add conditional Sandbox Watches in SetupWithManager with SandboxCRDExists() guard
  • Use mapWorkloadToAgentCard("agents.x-k8s.io/v1alpha1", "Sandbox") to enqueue AgentCard reconciliation on Sandbox changes
  • Add RBAC marker for agents.x-k8s.io sandboxes

This ensures that when a Sandbox workload's labels change (e.g., signature verification status), the NetworkPolicy controller reconciles and creates/updates the appropriate policy.

Closes #341

Test plan

  • Deploy operator with Sandbox CRD installed → verify Sandbox watch is registered
  • Create a Sandbox with kagenti.io/type: agent + AgentCard → verify NetworkPolicy is created
  • Deploy operator without Sandbox CRD → verify no error and watch is skipped

Assisted-By: Claude Code

Register a conditional Watches for the Sandbox CRD
(agents.x-k8s.io/v1alpha1) in the AgentCardNetworkPolicy controller's
SetupWithManager. This ensures that when the Sandbox CRD is installed,
changes to Sandbox objects with the agent label trigger reconciliation
of the owning AgentCard's NetworkPolicy.

Closes #341

Assisted-By: Claude (Anthropic AI) <noreply@anthropic.com>
Signed-off-by: cwiklik <cwiklikj@gmail.com>

@mrsabath mrsabath left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean addition of Sandbox watch support to the NetworkPolicy controller. Follows the same conditional-CRD pattern established in the AgentCardSync and ClientRegistration controllers (#338, #343). Correct use of SandboxCRDExists() guard, unstructured.Unstructured with sandboxGVK, mapWorkloadToAgentCard handler, and agentLabelPredicate() filter. RBAC marker added appropriately.

Areas reviewed: Go (operator controller), RBAC markers
CI status: all 16 checks passing

@cwiklik
cwiklik merged commit 8b02c00 into main May 8, 2026
16 checks passed
@pdettori
pdettori deleted the feat/sandbox-networkpolicy branch July 15, 2026 23:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

AgentCardNetworkPolicy controller does not watch Sandbox workloads

3 participants